<template>
    <div class="app-container">
        <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
            <el-form-item label="服务单号" prop="serviceOrderNumber">
                <el-input v-model="queryParams.serviceOrderNumber" placeholder="请输入服务单号" clearable size="small" @keyup.enter.native="handleQuery" />
            </el-form-item>
             <el-form-item label="诉求时间">
                <el-date-picker v-model="daterangeAppealTime" size="small" style="width: 240px" value-format="yyyy-MM-dd" type="daterange"
                    range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
            </el-form-item>
            <el-form-item label="受理区域" prop="acceptanceArea">
              <el-select v-model="queryParams.acceptanceArea" placeholder="请选择受理区域">
                <el-option
                  v-for="dict in dict.type.acceptance_area"
                  :key="dict.label"
                  :label="dict.label"
                  :value="dict.label"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="解决情况" prop="resolveSituation">
                <el-input v-model="queryParams.resolveSituation" placeholder="请输入解决情况" clearable size="small" @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="诉求类型" prop="typeAppeal">
              <el-select v-model="queryParams.typeAppeal" placeholder="请选择诉求类型">
                <el-option
                  v-for="dict in dict.type.type_appeal"
                  :key="dict.label"
                  :label="dict.label"
                  :value="dict.label"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="诉求内容" prop="appealContent">
                <el-input v-model="queryParams.appealContent" placeholder="请输入诉求内容" clearable size="small" @keyup.enter.native="handleQuery" />
            </el-form-item>
            <!--
            <el-form-item label="工单办结时间">
                <el-date-picker v-model="daterangeWorkOrderCompletionTime" size="small" style="width: 240px" value-format="yyyy-MM-dd"
                    type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
            </el-form-item>
            <el-form-item label="诉求类型" prop="typeAppeal">
                <el-input v-model="queryParams.typeAppeal" placeholder="请输入诉求类型" clearable size="small" @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="诉求主体类别" prop="categoryAppealSubject">
                <el-input v-model="queryParams.categoryAppealSubject" placeholder="请输入诉求主体类别" clearable size="small"
                    @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="转接号码" prop="transferNumber">
                <el-input v-model="queryParams.transferNumber" placeholder="请输入转接号码" clearable size="small" @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="是否直接答复" prop="replyDirectly">
                <el-input v-model="queryParams.replyDirectly" placeholder="请输入是否直接答复" clearable size="small" @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="是否派发部门" prop="distributeDepartments">
                <el-input v-model="queryParams.distributeDepartments" placeholder="请输入是否派发部门" clearable size="small"
                    @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="当前或最后处办部门" prop="handlingDepartment">
                <el-input v-model="queryParams.handlingDepartment" placeholder="请输入当前或最后处办部门" clearable size="small"
                    @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="一级归口" prop="firstLevelCentralizedManagement">
                <el-input v-model="queryParams.firstLevelCentralizedManagement" placeholder="请输入一级归口" clearable size="small"
                    @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="二级归口" prop="secondaryCentralizedManagement">
                <el-input v-model="queryParams.secondaryCentralizedManagement" placeholder="请输入二级归口" clearable size="small"
                    @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="三级归口" prop="thirdLevelCentralizedManagement">
                <el-input v-model="queryParams.thirdLevelCentralizedManagement" placeholder="请输入三级归口" clearable size="small"
                    @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="关键词" prop="keyWord">
                <el-input v-model="queryParams.keyWord" placeholder="请输入关键词" clearable size="small" @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="标题" prop="title">
                <el-input v-model="queryParams.title" placeholder="请输入标题" clearable size="small" @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="回访时间">
                <el-date-picker v-model="daterangeRevisitTime" size="small" style="width: 240px" value-format="yyyy-MM-dd" type="daterange"
                    range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
            </el-form-item>
            <el-form-item label="是否有效回访" prop="upEffective">
                <el-input v-model="queryParams.upEffective" placeholder="请输入是否有效回访" clearable size="small" @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="是否联系群众" prop="contactPublic">
                <el-input v-model="queryParams.contactPublic" placeholder="请输入是否联系群众" clearable size="small" @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="是否满意" prop="isSatisfied">
                <el-input v-model="queryParams.isSatisfied" placeholder="请输入是否满意" clearable size="small" @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="企业服务标签" prop="enterpriseServiceLabel">
                <el-input v-model="queryParams.enterpriseServiceLabel" placeholder="请输入企业服务标签" clearable size="small"
                    @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="优化营商环境标签" prop="optimizeBusinessEnvironmentLabeling">
                <el-input v-model="queryParams.optimizeBusinessEnvironmentLabeling" placeholder="请输入优化营商环境标签" clearable size="small"
                    @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="项目审批标签" prop="projectApprovalLabel">
                <el-input v-model="queryParams.projectApprovalLabel" placeholder="请输入项目审批标签" clearable size="small"
                    @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="半拉子工程标签" prop="halfPullEngineeringLabel">
                <el-input v-model="queryParams.halfPullEngineeringLabel" placeholder="请输入半拉子工程标签" clearable size="small"
                    @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="登记工号" prop="registerJobNumber">
                <el-input v-model="queryParams.registerJobNumber" placeholder="请输入登记工号" clearable size="small" @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="回访工号" prop="followUpWorkNumber">
                <el-input v-model="queryParams.followUpWorkNumber" placeholder="请输入回访工号" clearable size="small" @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="是否两代表一委员" prop="representativesCommitteeMember">
                <el-input v-model="queryParams.representativesCommitteeMember" placeholder="请输入是否两代表一委员" clearable size="small"
                    @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="工单办理时长" prop="durationOfWorkOrderProcessing">
                <el-input v-model="queryParams.durationOfWorkOrderProcessing" placeholder="请输入工单办理时长" clearable size="small"
                    @keyup.enter.native="handleQuery" />
            </el-form-item> -->
            <el-form-item>
                <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
                <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
            </el-form-item>
        </el-form>

        <el-row :gutter="10" class="mb8">
            <el-col :span="1.5">
                <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['bt:complaint:add']">新增</el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
                    v-hasPermi="['bt:complaint:edit']">修改</el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
                    v-hasPermi="['bt:complaint:remove']">删除</el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
                    v-hasPermi="['bt:complaint:export']">导出</el-button>
            </el-col>

            <el-col :span="1.5">
                <el-button type="info" plain icon="el-icon-upload2" size="mini" @click="handleImport">导入</el-button>
            </el-col>
            <!-- v-hasPermi="['system:user:import']" -->
            <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
        </el-row>

        <el-table v-loading="loading" :data="complaintList" @selection-change="handleSelectionChange">
            <el-table-column type="selection" width="55" align="center" />
            <!-- <el-table-column label="测试id" align="center" prop="id" /> -->
            <el-table-column label="服务单号" align="center" prop="serviceOrderNumber" />
            <el-table-column label="诉求时间" align="center" prop="appealTime">
                <template slot-scope="scope">
                    <span>{{ parseTime(scope.row.appealTime, '{y}-{m}-{d}') }}</span>
                </template>
            </el-table-column>
            <el-table-column label="工单办结时间" align="center" prop="workOrderCompletionTime">
                <template slot-scope="scope">
                    <span>{{ parseTime(scope.row.workOrderCompletionTime, '{y}-{m}-{d}') }}</span>
                </template>
            </el-table-column>
            <el-table-column label="受理区域" align="center" prop="acceptanceArea" />
            <!-- <el-table-column label="来源渠道" align="center" prop="sourceChannel" /> -->
            <el-table-column label="诉求类型" align="center" prop="typeAppeal" />
            <!-- <el-table-column label="诉求主体类别" align="center" prop="categoryAppealSubject" /> -->
            <!-- <el-table-column label="转接号码" align="center" prop="transferNumber" /> -->
            <!-- <el-table-column label="是否直接答复" align="center" prop="replyDirectly" /> -->
            <!-- <el-table-column label="是否派发部门" align="center" prop="distributeDepartments" /> -->
            <el-table-column label="当前或最后处办部门" align="center" prop="handlingDepartment" />
            <el-table-column label="工单状态" align="center" prop="workStatus" />
            <el-table-column label="一级归口" align="center" prop="firstLevelCentralizedManagement" />
            <el-table-column label="二级归口" align="center" prop="secondaryCentralizedManagement" />
            <el-table-column label="三级归口" align="center" prop="thirdLevelCentralizedManagement" />
            <!-- <el-table-column label="关键词" align="center" prop="keyWord" /> -->
            <el-table-column label="标题" align="center" prop="title" />
            <el-table-column label="诉求内容" align="center" prop="appealContent" :show-overflow-tooltip="true">
                <template slot-scope="scope">
                    <div v-html="scope.row.appealContent"></div>
                </template>
            </el-table-column>
            <el-table-column label="回访时间" align="center" prop="revisitTime">
                <template slot-scope="scope">
                    <span>{{ parseTime(scope.row.revisitTime, '{y}-{m}-{d}') }}</span>
                </template>
            </el-table-column>
            <!-- <el-table-column label="是否有效回访" align="center" prop="upEffective" /> -->
            <!-- <el-table-column label="是否联系群众" align="center" prop="contactPublic" /> -->
            <!-- <el-table-column label="是否满意" align="center" prop="isSatisfied" /> -->
            <el-table-column label="解决情况" align="center" prop="resolveSituation" />
            <!-- <el-table-column label="企业服务标签" align="center" prop="enterpriseServiceLabel" /> -->
            <!-- <el-table-column label="优化营商环境标签" align="center" prop="optimizeBusinessEnvironmentLabeling" /> -->
            <!-- <el-table-column label="项目审批标签" align="center" prop="projectApprovalLabel" /> -->
            <!-- <el-table-column label="半拉子工程标签" align="center" prop="halfPullEngineeringLabel" /> -->
            <el-table-column label="工程状态" align="center" prop="engineeringStatus" />
            <!-- <el-table-column label="登记工号" align="center" prop="registerJobNumber" /> -->
            <!-- <el-table-column label="回访工号" align="center" prop="followUpWorkNumber" /> -->
            <!-- <el-table-column label="是否两代表一委员" align="center" prop="representativesCommitteeMember" /> -->
            <!-- <el-table-column label="两代表一委员类型" align="center" prop="representativesCommitteeType" /> -->
            <!-- <el-table-column label="工单办理时长" align="center" prop="durationOfWorkOrderProcessing" /> -->
            <!-- <el-table-column label="备注" align="center" prop="remark" /> -->
            <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
                <template slot-scope="scope">
                    <el-button size="mini" type="text" icon="el-icon-tickets" v-hasPermi="['bt:complaint:query']"
                        @click="handleDetail(scope.row)">详情
                    </el-button>
                    <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
                        v-hasPermi="['bt:complaint:edit']">修改</el-button>
                    <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
                        v-hasPermi="['bt:complaint:remove']">删除</el-button>
                </template>
            </el-table-column>
        </el-table>

        <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />

        <!-- 添加或修改12345噪声污染投诉信息库对话框 -->
        <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
            <el-form ref="form" :model="form" :rules="rules" label-width="150px">
                <el-form-item label="服务单号" prop="serviceOrderNumber">
                    <el-input v-model="form.serviceOrderNumber" placeholder="请输入服务单号" />
                </el-form-item>
                <el-form-item label="诉求时间" prop="appealTime">
                    <el-date-picker clearable size="small" v-model="form.appealTime" type="date" value-format="yyyy-MM-dd" placeholder="请选择诉求时间">
                    </el-date-picker>
                </el-form-item>
                <el-form-item label="工单办结时间" prop="workOrderCompletionTime">
                    <el-date-picker clearable size="small" v-model="form.workOrderCompletionTime" type="date" value-format="yyyy-MM-dd"
                        placeholder="请选择工单办结时间">
                    </el-date-picker>
                </el-form-item>
                <el-form-item label="受理区域" prop="acceptanceArea">
                    <el-input v-model="form.acceptanceArea" placeholder="请输入受理区域" />
                </el-form-item>
                <el-form-item label="地点" prop="address">
                    <el-input v-model="form.address" placeholder="请输入地点" />
                </el-form-item>
                <el-form-item label="来源渠道" prop="sourceChannel">
                    <el-input v-model="form.sourceChannel" placeholder="请输入来源渠道" />
                </el-form-item>
                <el-form-item label="诉求类型" prop="typeAppeal">
                    <el-input v-model="form.typeAppeal" placeholder="请输入诉求类型" />
                </el-form-item>
                <el-form-item label="诉求主体类别" prop="categoryAppealSubject">
                    <el-input v-model="form.categoryAppealSubject" placeholder="请输入诉求主体类别" />
                </el-form-item>
                <el-form-item label="转接号码" prop="transferNumber">
                    <el-input v-model="form.transferNumber" placeholder="请输入转接号码" />
                </el-form-item>
                <el-form-item label="是否直接答复" prop="replyDirectly">
                    <el-input v-model="form.replyDirectly" placeholder="请输入是否直接答复" />
                </el-form-item>
                <el-form-item label="是否派发部门" prop="distributeDepartments">
                    <el-input v-model="form.distributeDepartments" placeholder="请输入是否派发部门" />
                </el-form-item>
                <el-form-item label="当前或最后处办部门" prop="handlingDepartment">
                    <el-input v-model="form.handlingDepartment" placeholder="请输入当前或最后处办部门" />
                </el-form-item>
                <el-form-item label="一级归口" prop="firstLevelCentralizedManagement">
                    <el-input v-model="form.firstLevelCentralizedManagement" placeholder="请输入一级归口" />
                </el-form-item>
                <el-form-item label="二级归口" prop="secondaryCentralizedManagement">
                    <el-input v-model="form.secondaryCentralizedManagement" placeholder="请输入二级归口" />
                </el-form-item>
                <el-form-item label="三级归口" prop="thirdLevelCentralizedManagement">
                    <el-input v-model="form.thirdLevelCentralizedManagement" placeholder="请输入三级归口" />
                </el-form-item>
                <el-form-item label="关键词" prop="keyWord">
                    <el-input v-model="form.keyWord" placeholder="请输入关键词" />
                </el-form-item>
                <el-form-item label="标题" prop="title">
                    <el-input v-model="form.title" placeholder="请输入标题" />
                </el-form-item>
                <el-form-item label="诉求内容">
                    <editor v-model="form.appealContent" :min-height="192" />
                </el-form-item>
                <el-form-item label="回访时间" prop="revisitTime">
                    <el-date-picker clearable size="small" v-model="form.revisitTime" type="date" value-format="yyyy-MM-dd" placeholder="请选择回访时间">
                    </el-date-picker>
                </el-form-item>
                <el-form-item label="是否有效回访" prop="upEffective">
                    <el-input v-model="form.upEffective" placeholder="请输入是否有效回访" />
                </el-form-item>
                <el-form-item label="是否联系群众" prop="contactPublic">
                    <el-input v-model="form.contactPublic" placeholder="请输入是否联系群众" />
                </el-form-item>
                <el-form-item label="是否满意" prop="isSatisfied">
                    <el-input v-model="form.isSatisfied" placeholder="请输入是否满意" />
                </el-form-item>
                <el-form-item label="解决情况" prop="resolveSituation">
                    <el-input v-model="form.resolveSituation" placeholder="请输入解决情况" />
                </el-form-item>
                <el-form-item label="企业服务标签" prop="enterpriseServiceLabel">
                    <el-input v-model="form.enterpriseServiceLabel" placeholder="请输入企业服务标签" />
                </el-form-item>
                <el-form-item label="优化营商环境标签" prop="optimizeBusinessEnvironmentLabeling">
                    <el-input v-model="form.optimizeBusinessEnvironmentLabeling" placeholder="请输入优化营商环境标签" />
                </el-form-item>
                <el-form-item label="项目审批标签" prop="projectApprovalLabel">
                    <el-input v-model="form.projectApprovalLabel" placeholder="请输入项目审批标签" />
                </el-form-item>
                <el-form-item label="半拉子工程标签" prop="halfPullEngineeringLabel">
                    <el-input v-model="form.halfPullEngineeringLabel" placeholder="请输入半拉子工程标签" />
                </el-form-item>
                <el-form-item label="登记工号" prop="registerJobNumber">
                    <el-input v-model="form.registerJobNumber" placeholder="请输入登记工号" />
                </el-form-item>
                <el-form-item label="回访工号" prop="followUpWorkNumber">
                    <el-input v-model="form.followUpWorkNumber" placeholder="请输入回访工号" />
                </el-form-item>
                <el-form-item label="是否两代表一委员" prop="representativesCommitteeMember">
                    <el-input v-model="form.representativesCommitteeMember" placeholder="请输入是否两代表一委员" />
                </el-form-item>
                <el-form-item label="工单办理时长" prop="durationOfWorkOrderProcessing">
                    <el-input v-model="form.durationOfWorkOrderProcessing" placeholder="请输入工单办理时长" />
                </el-form-item>
                <!-- <el-form-item label="逻辑删除标识(0-正常;非0删除)" prop="delFlag">
                    <el-input v-model="form.delFlag" placeholder="请输入逻辑删除标识(0-正常;非0删除)" />
                </el-form-item> -->
                <el-form-item label="备注" prop="remark">
                    <el-input v-model="form.remark" placeholder="请输入备注" />
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button type="primary" @click="submitForm">确 定</el-button>
                <el-button @click="cancel">取 消</el-button>
            </div>
        </el-dialog>
        
        <!-- 详情 -->
        <el-dialog class="fromDetail" title="详情" :visible.sync="openDetail" width="1000px" append-to-body>
            <el-form ref="form" :model="form" :rules="rules" label-width="130px">

                <!-- <div class="fromtitle"  v-if="form.finalExecuteCase">
                    <div>终结本次执行案件详情</div>
                </div> -->
                <el-row>
                    <el-col :span="8">
                        <el-form-item label="服务单号" prop="term">
                            <div>{{form.serviceOrderNumber}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="诉求时间" prop="term">
                            <div>{{form.appealTime}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="工单办结时间" prop="term">
                            <div>{{form.workOrderCompletionTime}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="受理区域" prop="term">
                            <div>{{form.acceptanceArea}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="地点" prop="term">
                            <div>{{form.address}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="来源渠道" prop="term">
                            <div>{{form.sourceChannel}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="诉求类型" prop="term">
                            <div>{{form.typeAppeal}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="诉求主体类别" prop="term">
                            <div>{{form.categoryAppealSubject}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="转接号码" prop="term">
                            <div>{{form.transferNumber}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="是否直接答复" prop="term">
                            <div>{{form.replyDirectly}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="是否派发部门" prop="term">
                            <div>{{form.distributeDepartments}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="当前或最后处办部门" prop="term">
                            <div>{{form.handlingDepartment}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="一级归口" prop="term">
                            <div>{{form.firstLevelCentralizedManagement}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="二级归口" prop="term">
                            <div>{{form.secondaryCentralizedManagement}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="三级归口" prop="term">
                            <div>{{form.thirdLevelCentralizedManagement}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="关键词" prop="term">
                            <div>{{form.keyWord}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="24">
                        <el-form-item label="标题" prop="term">
                            <div>{{form.title}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="24">
                        <el-form-item label="诉求内容" prop="term">
                            <div v-html="form.appealContent"></div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="回访时间" prop="term">
                            <div>{{form.revisitTime}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="是否有效回访" prop="term">
                            <div>{{form.upEffective}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="是否联系群众" prop="term">
                            <div>{{form.contactPublic}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="是否满意" prop="term">
                            <div>{{form.isSatisfied}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="解决情况" prop="term">
                            <div>{{form.resolveSituation}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="企业服务标签" prop="term">
                            <div>{{form.enterpriseServiceLabel}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="优化营商环境标签" prop="term">
                            <div>{{form.optimizeBusinessEnvironmentLabeling}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="项目审批标签" prop="term">
                            <div>{{form.projectApprovalLabel}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="半拉子工程标签" prop="term">
                            <div>{{form.halfPullEngineeringLabel}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="登记工号" prop="term">
                            <div>{{form.registerJobNumber}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="回访工号" prop="term">
                            <div>{{form.followUpWorkNumber}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="是否两代表一委员" prop="term">
                            <div>{{form.representativesCommitteeMember}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="工单办理时长" prop="term">
                            <div>{{form.durationOfWorkOrderProcessing}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="备注" prop="term">
                            <div>{{form.remark}}</div>
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>
        </el-dialog>
    <!-- 用户导入对话框 -->
    <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
      <el-upload
        ref="upload"
        :limit="1"
        accept=".xlsx, .xls"
        :headers="upload.headers"
        :action="upload.url"
        :disabled="upload.isUploading"
        :on-progress="handleFileUploadProgress"
        :on-success="handleFileSuccess"
        :auto-upload="false"
        drag
      >
        <i class="el-icon-upload"></i>
        <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
        <div class="el-upload__tip text-center" slot="tip">
          <!-- <div class="el-upload__tip" slot="tip">
            <el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的用户数据
          </div> -->
          <span>仅允许导入xls、xlsx格式文件。</span>
          <!-- <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate">下载模板</el-link> -->
        </div>
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFileForm">确 定</el-button>
        <el-button @click="upload.open = false">取 消</el-button>
      </div>
    </el-dialog>
    </div>
</template>

<script>
import { listComplaint, getComplaint, delComplaint, addComplaint, updateComplaint } from "@/api/complaint12345";
import { getToken } from "@/utils/auth";

export default {
dicts: ['acceptance_area','type_appeal'],
    name: "Complaint",
    data() {
        return {
            // 遮罩层
            loading: true,
            // 选中数组
            ids: [],
            // 非单个禁用
            single: true,
            // 非多个禁用
            multiple: true,
            // 显示搜索条件
            showSearch: true,
            // 总条数
            total: 0,
            // 12345噪声污染投诉信息库表格数据
            complaintList: [],
            // 弹出层标题
            title: "",
            // 是否显示弹出层
            open: false,
            // 是否显示详情弹出层
            openDetail: false,
            // 备注时间范围
            daterangeAppealTime: [],
            // 备注时间范围
            daterangeWorkOrderCompletionTime: [],
            // 备注时间范围
            daterangeRevisitTime: [],
            // 备注时间范围
            daterangeCreateTime: [],
            // 备注时间范围
            daterangeUpdateTime: [],
            // 查询参数
            queryParams: {
                pageNum: 1,
                pageSize: 10,
                serviceOrderNumber: null,
                appealTime: null,
                workOrderCompletionTime: null,
                acceptanceArea: null,
                address:null,
                sourceChannel: null,
                typeAppeal: null,
                categoryAppealSubject: null,
                transferNumber: null,
                replyDirectly: null,
                distributeDepartments: null,
                handlingDepartment: null,
                workStatus: null,
                firstLevelCentralizedManagement: null,
                secondaryCentralizedManagement: null,
                thirdLevelCentralizedManagement: null,
                keyWord: null,
                title: null,
                appealContent: null,
                revisitTime: null,
                upEffective: null,
                contactPublic: null,
                isSatisfied: null,
                resolveSituation: null,
                enterpriseServiceLabel: null,
                optimizeBusinessEnvironmentLabeling: null,
                projectApprovalLabel: null,
                halfPullEngineeringLabel: null,
                engineeringStatus: null,
                registerJobNumber: null,
                followUpWorkNumber: null,
                representativesCommitteeMember: null,
                representativesCommitteeType: null,
                durationOfWorkOrderProcessing: null,
            },
            // 表单参数
            form: {},
            // 表单校验
            rules: {
            },
      // 用户导入参数
      upload: {
        // 是否显示弹出层（用户导入）
        open: false,
        // 弹出层标题（用户导入）
        title: "",
        // 是否禁用上传
        isUploading: false,
        // 是否更新已经存在的用户数据
        updateSupport: 0,
        // 设置上传的请求头部
        headers: { Authorization: "Bearer " + getToken() },
        // 上传的地址
        url: process.env.VUE_APP_BASE_API + "/bt/complaint/import/data"
      },
        };
    },
    created() {
        this.getList();
    },
    methods: {
        /** 查询12345噪声污染投诉信息库列表 */
        getList() {
            this.loading = true;
            this.queryParams.params = {};
            if (null != this.daterangeAppealTime && '' != this.daterangeAppealTime) {
                this.queryParams.params["beginAppealTime"] = this.daterangeAppealTime[0];
                this.queryParams.params["endAppealTime"] = this.daterangeAppealTime[1];
            }
            if (null != this.daterangeWorkOrderCompletionTime && '' != this.daterangeWorkOrderCompletionTime) {
                this.queryParams.params["beginWorkOrderCompletionTime"] = this.daterangeWorkOrderCompletionTime[0];
                this.queryParams.params["endWorkOrderCompletionTime"] = this.daterangeWorkOrderCompletionTime[1];
            }
            if (null != this.daterangeRevisitTime && '' != this.daterangeRevisitTime) {
                this.queryParams.params["beginRevisitTime"] = this.daterangeRevisitTime[0];
                this.queryParams.params["endRevisitTime"] = this.daterangeRevisitTime[1];
            }
            if (null != this.daterangeCreateTime && '' != this.daterangeCreateTime) {
                this.queryParams.params["beginCreateTime"] = this.daterangeCreateTime[0];
                this.queryParams.params["endCreateTime"] = this.daterangeCreateTime[1];
            }
            if (null != this.daterangeUpdateTime && '' != this.daterangeUpdateTime) {
                this.queryParams.params["beginUpdateTime"] = this.daterangeUpdateTime[0];
                this.queryParams.params["endUpdateTime"] = this.daterangeUpdateTime[1];
            }
            listComplaint(this.queryParams).then(response => {
                this.complaintList = response.rows;
                this.total = response.total;
                this.loading = false;
            });
        },
        // 取消按钮
        cancel() {
            this.open = false;
            this.reset();
        },
        // 表单重置
        reset() {
            this.form = {
                id: null,
                serviceOrderNumber: null,
                appealTime: null,
                workOrderCompletionTime: null,
                acceptanceArea: null,
                address:null,
                sourceChannel: null,
                typeAppeal: null,
                categoryAppealSubject: null,
                transferNumber: null,
                replyDirectly: null,
                distributeDepartments: null,
                handlingDepartment: null,
                workStatus: "0",
                firstLevelCentralizedManagement: null,
                secondaryCentralizedManagement: null,
                thirdLevelCentralizedManagement: null,
                keyWord: null,
                title: null,
                appealContent: null,
                revisitTime: null,
                upEffective: null,
                contactPublic: null,
                isSatisfied: null,
                resolveSituation: null,
                enterpriseServiceLabel: null,
                optimizeBusinessEnvironmentLabeling: null,
                projectApprovalLabel: null,
                halfPullEngineeringLabel: null,
                engineeringStatus: "0",
                registerJobNumber: null,
                followUpWorkNumber: null,
                representativesCommitteeMember: null,
                representativesCommitteeType: null,
                durationOfWorkOrderProcessing: null,
                delFlag: null,
                createBy: null,
                createTime: null,
                updateBy: null,
                updateTime: null,
                remark: null
            };
            this.resetForm("form");
        },
        /** 搜索按钮操作 */
        handleQuery() {
            this.queryParams.pageNum = 1;
            this.getList();
        },
        /** 重置按钮操作 */
        resetQuery() {
            this.daterangeAppealTime = [];
            this.daterangeWorkOrderCompletionTime = [];
            this.daterangeRevisitTime = [];
            this.daterangeCreateTime = [];
            this.daterangeUpdateTime = [];
            this.resetForm("queryForm");
            this.handleQuery();
        },
        // 多选框选中数据
        handleSelectionChange(selection) {
            this.ids = selection.map(item => item.id)
            this.single = selection.length !== 1
            this.multiple = !selection.length
        },
        /** 新增按钮操作 */
        handleAdd() {
            this.reset();
            this.open = true;
            this.title = "添加12345噪声污染投诉信息库";
        },
        /** 修改按钮操作 */
        handleUpdate(row) {
            this.reset();
            const id = row.id || this.ids
            getComplaint(id).then(response => {
                this.form = response.data;
                this.open = true;
                this.title = "修改12345噪声污染投诉信息库";
            });
        },
        /** 提交按钮 */
        submitForm() {
            this.$refs["form"].validate(valid => {
                if (valid) {
                    if (this.form.id != null) {
                        updateComplaint(this.form).then(response => {
                            this.$modal.msgSuccess("修改成功");
                            this.open = false;
                            this.getList();
                        });
                    } else {
                        addComplaint(this.form).then(response => {
                            this.$modal.msgSuccess("新增成功");
                            this.open = false;
                            this.getList();
                        });
                    }
                }
            });
        },
        /** 删除按钮操作 */
        handleDelete(row) {
            const ids = row.id || this.ids;
            this.$modal.confirm('是否确认删除12345噪声污染投诉信息库编号为"' + ids + '"的数据项？').then(function () {
                return delComplaint(ids);
            }).then(() => {
                this.getList();
                this.$modal.msgSuccess("删除成功");
            }).catch(() => { });
        },
        /** 导出按钮操作 */
        handleExport() {
            this.download('bt/complaint/export', {
                ...this.queryParams
            }, `complaint_${new Date().getTime()}.xlsx`)
        },
        // 查看详情
        handleDetail(row) {
            // this.reset();
            const id = row.id || this.ids
            getComplaint(id).then(response => {
                this.form = response.data;
                this.openDetail = true;
            });
        },

        /** 导入按钮操作 */
        handleImport() {
            this.upload.title = "导入";
            this.upload.open = true;
        },
        /** 下载模板操作 */
        importTemplate() {
            this.download('system/user/importTemplate', {
            }, `user_template_${new Date().getTime()}.xlsx`)
        },
        // 文件上传中处理
        handleFileUploadProgress(event, file, fileList) {
            this.upload.isUploading = true;
        },
        // 文件上传成功处理
        handleFileSuccess(response, file, fileList) {
            this.upload.open = false;
            this.upload.isUploading = false;
            this.$refs.upload.clearFiles();
            this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
            this.getList();
        },
        // 提交上传文件
        submitFileForm() {
            this.$refs.upload.submit();
        }
    }
};
</script>
